instacart %>%
count(aisle) %>%
mutate(
aisle = factor(aisle),
aisle = fct_reorder(aisle, n)) %>%
plot_ly(x = ~aisle, y = ~n, color = ~aisle, type = "bar", colors = "viridis")
## Warning: `arrange_()` is deprecated as of dplyr 0.7.0.
## Please use `arrange()` instead.
## See vignette('programming') for more help
## This warning is displayed once every 8 hours.
## Call `lifecycle::last_warnings()` to see where this warning was generated.
instacart %>%
group_by(product_name, department) %>%
count(product_name) %>%
filter(n > 3000) %>%
plot_ly(x = ~product_name, y = ~n, type = "scatter", mode = "markers", color = ~product_name, alpha = 0.5)
## Warning in RColorBrewer::brewer.pal(N, "Set2"): n too large, allowed maximum for palette Set2 is 8
## Returning the palette you asked for with that many colors
## Warning in RColorBrewer::brewer.pal(N, "Set2"): n too large, allowed maximum for palette Set2 is 8
## Returning the palette you asked for with that many colors
instacart %>%
group_by(product_name, days_since_prior_order, department) %>%
filter(department %in% c("dairy eggs", "produce", "beverages", "pantry", "household", "snacks", "frozen", "international")) %>%
plot_ly(x = ~department, y = ~days_since_prior_order, type = "box", colors = "viridis")